package com.ygy.mapper;

import com.ygy.entity.Messages;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * <p>
 * 留言表 Mapper 接口
 * </p>
 *
 * @author Ye
 * @since 2024-03-14
 */
@Mapper
public interface MessagesMapper extends BaseMapper<Messages> {

    @Select("SELECT * FROM messages WHERE to_username = #{username} AND is_read = 0")
    List<Messages> selectUnreadMessagesByReceiver(@Param("username") String username);
}
